<script setup lang="ts">
import { ref } from "vue";

const show = ref(true);

const hide = () => {
  show.value = false;
};
</script>
<template>
  <div
    class="floating-bar"
    @click="hide"
    :style="`display:${show ? 'block' : 'none'};`"
  >
    <span class="layui-layer-setwin wechat-close">
      <a
        href="javascript:;"
        class="layui-layer-ico layui-layer-close layui-layer-close2"
      ></a>
    </span>
    <div class="top">在线客服</div>
    <div class="mid">
      <img src="/index/qr.jpg" alt="" />
    </div>
    <div class="bot">微信扫码咨询</div>
  </div>
</template>
<style scoped lang="scss">
@import "../../utils/scss/global.scss";

@include mobile {
  .floating-bar {
    display: none !important;
  }
}
.floating-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #fff;
  width: 120px;
  height: 160px;
  border: #eee 1px solid;
  padding: 0;
  border-radius: 4px;
  text-align: center;
  position: fixed;
  right: 40px;
  bottom: 200px;
  font-size: 12px;
  box-sizing: initial;
  z-index: 9999;
  box-shadow: 0 0 20px #ddd;
  & > span {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 0;
    line-height: initial;
    a {
      background-image: url(/index/close.png);
      position: absolute;
      right: -28px;
      top: -28px;
      width: 30px;
      height: 30px;
      margin-left: 0;
      transition: All 0.4s ease-in-out;
      &:hover {
        background-image: url(/index/close_hover.png);
        transform: rotate(180deg);
      }
    }
  }
  .top {
    font-weight: 700;
    color: white;
    font-size: 14px;
    background: #20a53a;
    line-height: 32px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    width: 100%;
  }
  .mid {
    display: flex;
    justify-content: center;
    margin: 10px auto 8px auto;
  }
  .bot {
    font-size: 12px;
  }
  img {
    width: 80px;
    height: 80px;
  }
}
</style>
